import axios from '@/utils/myHttp';

enum Api {
  INTERVIEWQC = '/api/interviewQCategories',
}

// Get personal center-basic settings
export const getInterviewQCategoriesApi = (query?) => {
  if (query) {
    console.log('🚀 ~ getInterviewQCategoriesApi ~ query:', query);
    let str = '?';
    Object.keys(query).forEach((key) => {
      str += `${key}=${query[key]}`;
    });
    return axios.get<any>(`${Api.INTERVIEWQC}${str}`);
  } else {
    return axios.get<any>(Api.INTERVIEWQC);
  }
};

export const postInterviewQCategoriesApi = (data) => axios.post(Api.INTERVIEWQC, data);

export const putInterviewQCategoriesApi = ({ id, ...data }) =>
  axios.put(`${Api.INTERVIEWQC}/${id}`, data);

export const deleteInterviewQCategoriesApi = ({ id }) => axios.delete(`${Api.INTERVIEWQC}/${id}`);
